package Core.Controls;

import ag.core.AGEngine;
import ag.core.AGView;
import android.graphics.RectF;

public abstract class AGControl {
	public RectF rect;
	public AGView view;
	
	public int width;
	public int height;
	
	public boolean isVisible;
	
	public AGControl(){
		this.rect = new RectF();
		this.isVisible = true;
	}
	
	public void onLoop(AGEngine engine){
		onUpdate(engine);
		onRender(engine);
	}
	
	public abstract void onUpdate(AGEngine engine);
	
	public abstract void onRender(AGEngine engine);
	
	public void setRect(RectF rect){
		this.rect.left = rect.left;
		this.rect.top = rect.top;
		this.rect.right = rect.right;
		this.rect.bottom = rect.bottom;
	}
	
	public void setPostion(float x, float y){
		this.rect.left = x;
		this.rect.top = y;
		this.rect.right = x + this.width;
		this.rect.bottom = y + this.height;
	}
}
